package pc15;

import java.util.Scanner;

public class J09SungJuk {

	public static void main(String[] args) {
		//Method를 이용한 성적 처리
		final int num = 2;
		String[] name=new String[num];
		int kor[]=new int[num],eng[]=new int[num];
		int mat[]=new int[num],tot[]=new int[num];
		double avg[]=new double[num];
		char grd[]=new char[num];
		Scanner sc = null;
		String result="";
		
		//static method로 객체 미생성 사용 가능
		inputSungJuk(sc,name,kor,eng,mat);
		getTotal(kor, eng, mat, tot);
		getAvg(tot, avg);
		getGrd(avg, grd);
		//결과 출력
		System.out.println(name);
		System.out.println(name[1]);
		System.out.println(kor[1]);
		System.out.println(eng[1]);
		System.out.println(mat[1]);
		
	}//main
	
	// static 선언시 객체 생성 없이 method 사용 가능
	public static void inputSungJuk(Scanner sc,
	String[] name,int[] kor,int[] eng,int[] mat){
		sc = new Scanner(System.in); 
		
		System.out.println("이름: ");	 name[1] = sc.next();
		System.out.print("국어성적: "); kor[1] = sc.nextInt();
		System.out.print("영어성적: "); eng[1] = sc.nextInt();
		System.out.print("수학성적: "); mat[1] = sc.nextInt();
		sc.close();
	}//inputSungJuk
	
	public static void getTotal(int[] kor, int[] eng, int[] mat, 
			int[] tot){
		tot[1] = kor[1]+eng[1]+mat[1];
	}
	
	public static void getAvg(int[] tot, double[] avg){
		avg[1] = (double)tot[1]/3;
	}
	
	public static void getGrd(double[] avg, char[] grd){
		switch((int)avg[1] / 10){
		case 10: 
		case 9: grd[1] = '수'; break;
		case 8: grd[1] = '우'; break;
		case 7: grd[1] = '미'; break;
		case 6: grd[1] = '양'; break;
		default: grd[1] = '가';
		}
	}
	
}//class
